using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DTO;
using DAL;
using BUS;
using Utility;
public partial class admin_A_tinhtrang_Donhang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loaddata();
        }
    }
    private void loaddata()
    {
        try
        {
            //string tendangnhap = Session["TaiKhoan"].ToString();
            //if (tendangnhap != "")
            //{
            //    lit_tennguoidung.Text = Session["TaiKhoan"].ToString();

            //}
            //else
            //{
            //    Session["taikhoan"] = "";
            //}
            //int id = int.Parse(Session["manv"].ToString());
            //HyperLink1.NavigateUrl = "~/admin/A_suanhanvien.aspx?id=" + id;
        }
        catch (Exception ex)
        {
            Response.Redirect("~/admin/A_dangnhap.aspx");
        }

        Criteria cri = new Criteria();


        if (txttentinhtrangdh.Text != "")
        {
            cri.add(Condition.AND, TinhTrang_DonHangColumns.TenTinhTrang, Condition.LIKE, txttentinhtrangdh.Text);
        }
        if (txtmatinhtrangdh.Text != "")
        {
            cri.add(Condition.AND, TinhTrang_DonHangColumns.MaTinhTrang_DH, Condition.EQUAL, int.Parse(txtmatinhtrangdh.Text));
        }
        int total = 0;
        TinhTrang_DonHangCollection ttsp = TinhTrang_DonHang_BUS.Get(cri.Criter, 0, 0, TinhTrang_DonHangColumns.MaTinhTrang_DH.ToString(), OrderDirection.ASC.ToString(), out total);
        Repeater1.DataSource = ttsp;
        Repeater1.DataBind();



    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {

            TinhTrang_DonHang_DTO lh = (TinhTrang_DonHang_DTO)e.Item.DataItem;
            HyperLink hplsua = (HyperLink)e.Item.FindControl("hplsua");
            hplsua.NavigateUrl = "~/admin/A_tinhtrang_dh_update.aspx?matinhtrang=" + lh.MaTinhTrang_DH.ToString();

        }
    }
    protected void bttimkiem_Click(object sender, EventArgs e)
    {
        loaddata();

    }
}
